﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Windows;

namespace PESWindowsPhone.Util
{
    public class DataRequest
    {
        public DownloadStringCompletedEventHandler DataReceived;
        private HttpWebRequest webRequest;
        
        public DataRequest()
        {
            GetResults("http://www.psmorandi.com/peschampweb/serv/rank.aspx?id=1");
        }

        public void GetResults(string websiteURL)
        {
            WebClient c = new WebClient();
            c.DownloadStringAsync(new Uri(websiteURL));
            c.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCompleted);
        }

        public void DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            DataReceived.Invoke(this, e);
        }
    }
}
